﻿using System;

namespace AcademicPlanner.Domain
{
	/// <summary>
	/// Represents an exception that is critical/fatal to the
	/// application execution; such exceptions concern errors that
	/// can't be reported in full to the user and are usually technincal errors
	/// rather than application logic violations.
	/// </summary>
	/// <version>1.0</version>
	/// <since>1.0</since>
    public class CriticalDomainException : DomainException
    {
		/// <summary>
		/// Gets the error message associated with this CriticalDomainException based on its error code
		/// and its <c>InnerException</c> if any.
		/// </summary>
		/// <version>1.0</version>
		/// <since>1.0</since>
		public override string Message { get { return GetErrorCodeMessage(errorCode) +
				(InnerException != null ? " - " + InnerException.Message : "");
		}
		}


		/// <summary>
		/// Constructs a CriticalDomainException by initializing its <c>ErrorCode</c> with the given
		/// <c>DomainErrorCode</c>.
		/// </summary>
		/// <param name="pCode">The <c>DomainErrorCode</c> for this CriticalDomainException.</param>
		/// <seealso cref="M:DomainException.DomainException(DomainErrorCode)"/>
		/// <version>1.0</version>
		/// <since>1.0</since>
		public CriticalDomainException(DomainErrorCode pCode)
			: base(pCode)
		{
			
		}

		/// <summary>
		/// Constructs a CriticalDomainException by initializing its <c>ErrorCode</c> with the given
		/// <c>DomainErrorCode</c> and its <c>InnerException</c> with the given <c>Exception</c>.
		/// </summary>
		/// <param name="pCode">The <c>DomainErrorCode</c> for this CriticalDomainException.</param>
		/// <param name="pInnerException">The <c>InnerException</c> for this CriticalDomainException.</param>
		/// <seealso cref="M:DomainException.DomainException(DomainErrorCode, Exception)"/>
		/// <version>1.0</version>
		/// <since>1.0</since>
		public CriticalDomainException(DomainErrorCode pCode, Exception pInnerException)
			: base(pCode, pInnerException)
		{

		}
    }
}
